Data Structure Theory Assignment 2


Question#1a)      What are the advantages of doubly linked list over singly linked list?


Advantages over singly linked list
1) A DLL can be traversed in both forward and backward direction.
2) The delete operation in DLL is more efficient if pointer to the node to be deleted is given.
In singly linked list, to delete a node, pointer to the previous node is needed. To get this
 previous node, sometimes the list is traversed. In DLL, we can get the previous node using previous pointer.

a)      What’s the difference between singly, doubly and circular linked list?


Singly linked list

A singly linked list is a linked list where the node contains some data and a pointer to the next node in the list
It allows traversal only in one way
It uses less memory per node (single pointer)

Doubly

A doubly linked list is complex type of linked list where the node contains some data and a pointer to the next as well as the previous node in the list
It allows a two way traversal
It uses more memory per node(two pointers)

circular:

Circular linked list is a linked list where all nodes are connected to form a circle.
There is no NULL at the end. A circular linked list can be a singly circular linked list or doubly circular linked list.

Question#2a)      What is time complexity?
b)      Define mathematical model of time complexity.

It is simple measurement of how fast time taken  by a program grows,
 if the input size ‘n’ and time ‘t’ then t is directly proportional to ‘n’


total running time =sum*cost of frequency for all operations .
cost: depends on compiler
frequency: depends on input or algo


Comments

  1. Do you want to conv Do you want to convert cryptocurrency into real money, then bitcoin exchanger is dream website for this purpose, you can make your transaction here easily with full confidence.

    ReplyDelete

Post a Comment

Popular posts from this blog

Computer Programming Lab 5

Computer Programming lab 11

Computer Programming Lab 4