User Tools

Site Tools


study_2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
study_2 [2020/06/22 16:00] jrsetistudy_2 [2020/11/03 21:32] (current) jrseti
Line 1: Line 1:
 +=====One hour interview Video====
 +
 +https://www.youtube.com/watch?v=3yQ4Jaumw3g
 +
 ====Binary Heaps==== ====Binary Heaps====
  
Line 5: Line 9:
 enqueue or dequeue items in O(logn) enqueue or dequeue items in O(logn)
  
-Priority Queues use a min heap or max heap+**Priority Queues** use a min heap or max heap. In Java use the Comparator: 
 + 
 +<code> 
 +import java.util.*;  
 + 
 +... 
 +PriorityQueue<Student> pq = new PriorityQueue<Student>(5, new StudentComparator()); 
 +... 
 +              
 + 
 +Class StudentComparator implements Comparator<Student>{  
 +               
 +            // Overriding compare()method of Comparator   
 +                        // for descending order of cgpa  
 +            public int compare(Student s1, Student s2) {  
 +                if (s1.cgpa < s2.cgpa)  
 +                    return 1;  
 +                else if (s1.cgpa > s2.cgpa)  
 +                    return -1;  
 +                                return 0;  
 +                }  
 +        }  
 +</code>
  
 ====Reverse Singly Linked List==== ====Reverse Singly Linked List====
study_2.1592841618.txt.gz · Last modified: 2020/06/22 16:00 by jrseti