gs gs121 Abstract Data Types - Priority Queue - Quiz No.1
gs gs121 Data Structures and Algorithms Quiz
This quiz belongs to book/course code gs gs121 Data Structures and Algorithms of gs organization. We have 169 quizzes available related to the book/course Data Structures and Algorithms. This quiz has a total of 8 multiple choice questions (MCQs) to prepare and belongs to topic Abstract Data Types. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
(head and trail are dummy nodes to mark the end and beginning of the list, they do not contain any priority or element)
public void insert_key(int key,Object item) { if(key<0) { Systerm.our.println("invalid"); System.exit(0); } else { Node temp = new Node(key,item,null); if(count == 0) { head.setNext(temp); temp.setNext(trail); } else { Node dup = head.getNext(); Node cur = head; while((key>dup.getKey()) && (dup!=trail)) { dup = dup.getNext(); cur = cur.getNext(); } cur.setNext(temp); temp.setNext(dup); } count++; } }
public void insert_key(int key,Object item) { if(key<0) { Systerm.our.println("invalid"); System.exit(0); } else { Node temp = new Node(key,item,null); if(count == 0) { head.setNext(temp); temp.setNext(trail); } else { Node dup = head.getNext(); Node cur = dup; while((key>dup.getKey()) && (dup!=trail)) { dup = dup.getNext(); cur = cur.getNext(); } cur.setNext(temp); temp.setNext(dup); } count++; } }
public void insert_key(int key,Object item) { if(key<0) { Systerm.our.println("invalid"); System.exit(0); } else { Node temp = new Node(key,item,null); if(count == 0) { head.setNext(temp); temp.setNext(trail); } else { Node dup = head.getNext(); Node cur = head; while((key>dup.getKey()) && (dup!=trail)) { dup = dup.getNext(); cur = cur.getNext(); } cur.setNext(dup); temp.setNext(cur); } count++; } }
public void insert_key(int key,Object item) { if(key<0) { Systerm.our.println("invalid"); System.exit(0); } else { Node temp = new Node(key,item,null); if(count == 0) { head.setNext(temp); temp.setNext(trail); } else { Node dup = head.getNext(); Node cur = head; while((key>dup.getKey()) && (dup!=trail)) { dup = cur cur = cur.getNext(); } cur.setNext(dup); temp.setNext(cur); } count++; } }
public Object delete_key() { if(count == 0) { System.out.println("Q is empty"); System.exit(0); } else { Node cur = head.getNext(); Node dup = cur.getNext(); Object e = cur.getEle(); head.setNext(dup); count--; return e; } }