Skip to main content

Posts

Showing posts from February, 2019

a simple example of linked list

working sample code-> https://stackblitz.com/edit/typescript-mzgnay operation done:- add item is a linked list->at last add item at starting remove item by value remove item by index insert item before insert item after reverse linked list code:- //Linked list --------------------------------------------------- //create a class which holds data and address of next class //newNode class newNode { //data which can store any type of data but right now i am not handling array and object data type only string or number data : any ; next : newNode ; } class LinkedList { //Head store first node in linked list Head : newNode = null ; //last node in the linked list Tail : newNode = null ; //length of linked list len : number = 0 ; /* push a node at last of linked list */ public push ( data : any ) //push data { //create a new node---step1 var node = new newNode ();...