Nice explanation.we want this type of detailed,in-depth and easy data structures,algorithms analysis & design principles complete videos series..many thanks.
yes, Java is more interesting to code in my opinion.. C is low lever, so it's more difficult to interpret for the user.... closer significance to the machine-level code tho
The same principle I learnt from him and improved slightly, I suppose, below is the code for the same: public class Queue { private int[] q; private int front,rear,capcity; Queue(){ this.front=0; this.rear=0; this.capcity =2; q = new int[capcity]; } void enqueue(int data){ if(rear==capcity){ capcity = capcity*2; int[] temp = new int[capcity]; System.arraycopy(q,0,temp,0,q.length); q=temp; } q[rear++] = data; } void show(){ for(int i=front;i
why we do not use enhanced for loop for printing the element if we use enhanced for loop for printing the element then dequeue method id not working properly
No suppose u add 4 elements then rear value will be 4 and size is 4 If u remove two elements then front is 2 and size is 2 Now size and rear are not same
Queue is an interface when you use import java.util.Queue; but in this case he makes a class called "Queue", so he is able to make an object out of it.