Course Solutions Uncategorized (Solved) : 5 List Explain Big Oh Runtimes Enqueue Dequeue Getfront 2 Different Implemenations Queue I Q34522637 . . . .

(Solved) : 5 List Explain Big Oh Runtimes Enqueue Dequeue Getfront 2 Different Implemenations Queue I Q34522637 . . . .

 

5. List and explain the Big-Oh runtimes of enqueue, dequeue, andgetFront for 2 different implemenations of a queue. Bothimplementaions use a node-based implementation (single-link) thathas pointers to both the head and tail nodes:

Implementation 1: enqueues at the head anddequeues at the tail
Implementation 2: enqueues at the tail anddequeues at the head

A)

Implementation 1) Enqueue = O(1) as putting node in head takesconstant time.

Dequeue = O(n) as to delete a node from tail we have to scan thewhole list first.

getFront = O(1) as we are enqueuing at the head.

Implementation 2) Enqueue = O(n) as to insert a node from tailwe have to

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post