Part8DataStructure

  Рет қаралды 17,814

Brototype Malayalam

Brototype Malayalam

Күн бұрын

Пікірлер: 64
@muhaimenkm1
@muhaimenkm1 3 жыл бұрын
For removing duplicate elements from a linked list. You don't need to iterate over 2 loops: public void deleteDuplicate() { Node current = head; Node next = head.next; while (next != null) { if (current.data == next.data) current.next = next.next; else current = next; next = next.next; } } This also works.
@favazabdulrasheed58
@favazabdulrasheed58 3 жыл бұрын
Super bro Simple and powerful
@jelanmathewjames2579
@jelanmathewjames2579 2 жыл бұрын
i Think code need to check whether next is tail or not otherwise tail will lost the connection and new linkedlist will be created with not head
@ashmil8303
@ashmil8303 3 жыл бұрын
Reverse single linked list public void reverse() { Node pre = null; Node curr = head; while (curr != null) { Node cnex = curr.next; curr.next = pre; pre = curr; curr = cnex; } head = pre; }
@muhammedrinshid8047
@muhammedrinshid8047 2 жыл бұрын
this also works public void deleteDuplicate(){ Node temp=head; while(temp.next!=null){ if(temp.data==temp.next.data){ temp.next=temp.next.next; }else{ temp=temp.next; } } }
@mohammedmishal3123
@mohammedmishal3123 2 жыл бұрын
ellavarum nalla effort ittu nalla knowledgable contents tharunnu thanks to Nikhil sir and ur wonderful team doubt: the above can only delete the duplicates of same and consecutive data? when I entered 20 10 20 20 output: 20 10 20
@venti6100
@venti6100 Жыл бұрын
sorted list ill mathre eth cheyan pattu
@abhiram8035
@abhiram8035 Жыл бұрын
In this program the if condition for tail==next doesnt work because the while loop before will make the next null if this scenario arises and this condition will never happen. The program works without it as we dont need to change the tail. it can be written like this. public void removeduplicate() { Node current = head; while(current != null) { Node next=current.next; while(next!= null&& next.data == current.data) { next = next.next; } current.next = next; current = next; } } by brototype student
@minhajmin2951
@minhajmin2951 6 ай бұрын
bro,1 2 3 3 3 anel,tail maintain cheyyunnudel, tail nte value pinne 2 avunillallo e code l ?,sorry if i wrong
@JobinSelvanose
@JobinSelvanose 3 жыл бұрын
advance congratulations for reaching 100k subscribers.
@shahinshahchelothil
@shahinshahchelothil 3 жыл бұрын
27:25 Exactly My Reaction 😂
@36_mohmdshaskt77
@36_mohmdshaskt77 3 жыл бұрын
Nice 🔥🔥
@arshalabbas
@arshalabbas 3 жыл бұрын
Nikhil Sir: next next next next next Le njan: 🤯🤯🤯 😂😂😂
@redstoneninja3375
@redstoneninja3375 3 жыл бұрын
hi da
@harisankar7958
@harisankar7958 2 жыл бұрын
It is very easy to understand the concepts but it is light difficult to implement it in code 🥺😔
@Ksk9360
@Ksk9360 3 жыл бұрын
Aaro paranj manushyanmar swarthigal enn. Njan adine vishwasich. But brototype kanden shesham manaslayi Adhyam njan vishwasichad kallamaanen. (Chumma oru कविता) Oru prathifalam apekshikaadhe ningal cheyunna ee karyamundallo great. Vidya daana shreshtra daana ✌. Brototype channel fan from karnataka ( njan oru videoyil thangal malayaleesn vendi idokke cheyunathenn ket. But non malayaleesum idine kelkunund and practice cheyd Knowledge gain cheyunind). Njanoru nalla devoloper aayen shesham futurl Ee chanelnde perl kannada version videos cheyum❤ .
@BrototypeMalayalam
@BrototypeMalayalam 3 жыл бұрын
😍😍😍 great
@richard_shaju
@richard_shaju Жыл бұрын
Selection Sort in linkedList public void sort() { Node temp = head; while (temp != null) { Node small = temp; Node x = temp.next; while (x != null) { if (x.data < small.data) { small = x; } x = x.next; } int t = small.data; small.data = temp.data; temp.data = t; temp = temp.next; } }
@ashajoel2021
@ashajoel2021 3 жыл бұрын
Hlpful video
@ramsankar4319
@ramsankar4319 2 жыл бұрын
removing duplicates using a single while loop: public void removeDuplicates(){ Node temp = head; if(temp == null){ System.out.println("empty list"); return; } while(temp.next != null){ if(temp.next.data != temp.data){ temp = temp.next; continue; } temp.next = temp.next.next; } }
@thomastsojan4367
@thomastsojan4367 3 жыл бұрын
public class SinglyLinkedList { static class Node{ int data; Node next; } Node head,tail; int length = 0; // INSERT NODE AT START POSITION void insertStart(int value){ Node node = new Node(); node.data = value; node.next = null; if (head == null){ head = node; tail = node; } else{ node.next = head; head = node; } length++; } // INSERT NODE AT END POSITION void insertEnd(int value){ Node node = new Node(); node.data = value; node.next = null; if(head == null) { head = node; tail = node; } else{ tail.next = node; tail = node; } length++; } // INSERT NODE AT SPECIFIC POSITION void insertPosition(int index,int value){ Node node = new Node(); node.data = value; node.next = null; if(index ==0){ insertStart(value); } else if(index == length){ insertEnd(value); } else { int indexCounter = 0; Node current = head; while (indexCounter < index - 1) { current = current.next; indexCounter++; } node.next = current.next; current.next = node; length++; } } // DELETE NODE AT START POSITION void deleteStart(){ if(head == null){ System.out.println("Linked List Empty"); } else{ head = head.next; length--; } } // DELETE NODE AT END POSITION void deleteEnd(){ if(head == null){ System.out.println("Linked List Empty"); } else{ if(head != tail){ Node current = head; while(current.next != tail){ current = current.next; } tail = current; tail.next = null; length--; } else{ head = tail =null; } } } // DELETE NODE AT SPECIFIC POSITION void deletePos(int index){ if(index == 0) deleteStart(); else if(index == length-1) deleteEnd(); else{ Node current = head; for(int i = 0;i
@BroForYou
@BroForYou 3 жыл бұрын
Bros polii 😍😍❤️❤️
@GOODIESS
@GOODIESS 3 жыл бұрын
Head and tail vere oru variable vech exchange cheyth athh reverse aavum
@AVyt28
@AVyt28 3 жыл бұрын
Agile workflow engana work 1 weekil complete cheyunne??Ente task ellam spill over avum 😒😒
@safwankanniyath7694
@safwankanniyath7694 3 жыл бұрын
adipoli
@Econobees007
@Econobees007 3 жыл бұрын
Thanks 😘😘☄️☄️☄️
@nihalabdrazack3769
@nihalabdrazack3769 3 жыл бұрын
🤩🤩
@hishamahammmedkm1936
@hishamahammmedkm1936 3 жыл бұрын
Nikhil sir explained very well
@fhgtfghgfg
@fhgtfghgfg 10 ай бұрын
😕😕
@r4raash890
@r4raash890 3 жыл бұрын
Good
@vinuviswanath1728
@vinuviswanath1728 3 жыл бұрын
public void displayBackward() { Node temp = head, lastNode = tail; while (temp != null) { Node currentNode = temp; if(temp==lastNode){ System.out.println(lastNode.data); return; } while (currentNode.next == lastNode) { System.out.println(lastNode.data); lastNode = currentNode; temp = head; } if(lastNode != currentNode){ temp = temp.next; } } //Space Complexity ==> O(1) //Time Complexity ==> O((n-1!)) }
@vinuviswanath1728
@vinuviswanath1728 3 жыл бұрын
public void displayBackward() { Node temp = head, lastNode = tail; while (temp != null) { Node currentNode = temp; if(temp==lastNode){ System.out.println(lastNode.data); return; } while (currentNode.next == lastNode) { System.out.println(lastNode.data); lastNode = currentNode; temp = head; } if(lastNode != currentNode){ temp = temp.next; } } //Space Complexity ==> O(1) //Time Complexity ==> O((n(n-1)/2)) }
@mhdfavascheru8481
@mhdfavascheru8481 Жыл бұрын
@@vinuviswanath1728 the second while loop can be replaced with the if condition. because that while loop is only executed once
@uv1906
@uv1906 3 жыл бұрын
❤❤❤❤❤
@adarshlakshmanan
@adarshlakshmanan 3 жыл бұрын
Java Solution: ----------------------------------------------- void reverse() { Node prevNode = null; var currNode = head; while (currNode != null) { var nextNode = currNode.next; currNode.next = prevNode; prevNode = currNode; currNode = nextNode; } Node temp = tail; tail = head; head = temp; } Space = O(1) Time = O(n)
@ajnashibnumer8586
@ajnashibnumer8586 3 жыл бұрын
♥️♥️
@ashishjaimon6029
@ashishjaimon6029 3 жыл бұрын
class LinkedList { static Node head; static class Node { int data; Node next; Node(int d) { data = d; next = null; } } /* Function to reverse the linked list */ Node reverse(Node node) { Node prev = null; Node current = node; Node next = null; while (current != null) { next = current.next; current.next = prev; prev = current; current = next; } node = prev; return node; } void printList(Node node) { while (node != null) { System.out.print(node.data + " "); node = node.next; } } // Driver Code public static void main(String[] args) { LinkedList list = new LinkedList(); list.head = new Node(1); list.head.next = new Node(2); list.head.next.next = new Node(3); list.head.next.next.next = new Node(7); System.out.println("Given Linked list"); list.printList(head); head = list.reverse(head); System.out.println(""); System.out.println("Reversed linked list "); list.printList(head); } } Given linked list 1 2 3 7 Reversed Linked list 7 3 2 1 Time Complexity: O(n) Space Complexity: O(1)
@yazinsha2370
@yazinsha2370 3 жыл бұрын
ennikk oru project unnd arengilum ennne help cheyyyuo (tech ayittt)
@DLUXMNI
@DLUXMNI 3 жыл бұрын
njan oru freelancer anu so ennne kondu cheyyyan pattunnath njan cheyyydhu thraaam
@yazinsha2370
@yazinsha2370 3 жыл бұрын
@@DLUXMNI thank you sir
@yazinsha2370
@yazinsha2370 3 жыл бұрын
@@DLUXMNI egane contact cheyyum
@JobinSelvanose
@JobinSelvanose 3 жыл бұрын
@@yazinsha2370 i can also help you for sharing more details share you contact details at jobins9633@gmail dotcom
@JobinSelvanose
@JobinSelvanose 3 жыл бұрын
@@DLUXMNI great
@orion9686
@orion9686 3 жыл бұрын
🔥🔥
@nandhu2030
@nandhu2030 3 жыл бұрын
First view🥰🥰🥰
@ajithakhil7079
@ajithakhil7079 2 жыл бұрын
to remove duplicates public void removeDuplicates() { Node temp=head,prev=null; while(temp!=null) { prev=temp; while(temp.nextAddress!=null &&temp.data==temp.nextAddress.data ) { temp=temp.nextAddress; prev.nextAddress=temp.nextAddress; }if(temp==tail) { return; } temp=temp.nextAddress; }if(temp==null) { return; } }
@akshaypkk
@akshaypkk 3 жыл бұрын
sonu fan❤❤
@PriyanjithN
@PriyanjithN Жыл бұрын
Reverse a Single Linked list public class SLinkedList { class Node { int data; Node next; Node(int data){ this.data=data; } } public Node head=null; public Node tail=null; public void addNode(int data) { Node newNode=new Node(data); if(head==null) { head=newNode; }else { tail.next=newNode; } tail=newNode; } public void displayNode() { if(head==null) { System.out.println("empty"); } Node temp=head; while(temp!=null) { System.out.println(temp.data); temp=temp.next; } } public void reverseNode() { Node temp=head.next,pre=head,next=null; while(temp!=null) { head.next=temp.next; next=temp.next; temp.next=pre; pre=temp; temp=next; } temp=head; head=tail; tail=temp; } public static void main(String[] args) { SLinkedList list=new SLinkedList(); list.addNode(3); list.addNode(2); list.addNode(1); list.addNode(6); list.addNode(7); System.out.println("Normal Node given"); list.displayNode(); list.reverseNode(); System.out.println("Resversed Node:"); list.displayNode(); } } OUTPUT: Normal Node given 1 2 3 4 5 Resversed Node: 5 4 3 2 1 O(n)T & O(1)s alle..
@mukammedraheem4969
@mukammedraheem4969 Жыл бұрын
java script doubly linked list duplicate deletion code class Node { constructor(data){ this.data = data; this.next = null; this.prev = null; } } class DoubleLinkedList{ constructor (){ this.head = null; this.tail = null; } addingINIT(data){ let newNode = new Node(data); if (this.head == null){ this.head = newNode; }else{ this.tail.next = newNode; newNode.prev = this.tail; } this.tail = newNode; } display(){ let temp = this.head; while(temp !=null ){ console.log(temp.data); temp = temp.next; } } displayReverse(){ let temp = this.tail; while(temp != null){ console.log(temp.data); temp = temp.prev; } } deleting(data){ let temp = this.head; if(temp.data == data){ this.head = temp.next; this.head.prev = null; return; } while( temp != null && temp.data != data){ temp = temp.next; } if (temp == null ){ return; } if(temp == this.tail){ this.tail = temp.prev; this.tail.next = null; return; } temp.prev.next = temp.next; temp.next.prev = temp.prev; } repeatDeleting(){ let temp = this.head; while(temp != null){ let bob = temp.next; while( bob != null && bob.data === temp.data){ bob = bob.next; } temp.next = bob; if (bob == null){ this.tail = temp; this.tail.next = null; }else{ bob.prev = temp; } temp = bob; } } } let list = new DoubleLinkedList(); list.addingINIT(10); list.addingINIT(10); list.addingINIT(10); list.addingINIT(20); list.addingINIT(20); list.addingINIT(20); list.addingINIT(30); list.addingINIT(40); list.addingINIT(40); list.addingINIT(50); // console.log(list.tail); // list.deleting(20); // list.display(); // console.log("----------------"); // list.displayReverse(); list.display(); console.log("----------------"); list.repeatDeleting(); // list.display(); console.log("----------------"); list.displayReverse(); out put :- 10 10 10 20 20 20 30 40 40 50 ---------------- ---------------- 50 40 30 20 10
@anilantony2216
@anilantony2216 3 жыл бұрын
package sample; public class ReverseList { class Node{ int data; Node next; Node(int data) { this.data = data; } } public Node head = null; public Node tail = null; public void addNode(int data) { Node newNode = new Node(data); if(head == null) { head = newNode; tail = newNode; }else{ tail.next = newNode; tail = newNode; } } public void reverse(Node current) { if(head == null) { System.out.println("empty"); return; } else { if(current.next == null) { System.out.print(current.data + " "); return; } reverse(current.next); System.out.print(current.data + " "); } } public void display() { Node current = head; if(head == null) { System.out.println("empty"); return; } while(current != null) { System.out.print(current.data + " "); current = current.next; } System.out.println(); } public static void main(String[] args) { ReverseList List = new ReverseList(); List.addNode(1); List.addNode(2); List.addNode(3); List.addNode(4); List.display(); List.reverse(List.head); } } O(n)T O(1)S
@redstoneninja3375
@redstoneninja3375 3 жыл бұрын
100th like :D
@shukoorraother.4022
@shukoorraother.4022 3 жыл бұрын
സർ Software engineering ഇൽ programming മാത്രമേ ഉള്ളോ കാരണം എന്നിക്ക് software engineering ഇഷ്ട്ടമാണ് പക്ഷെ programming ഇഷ്ട്ടമല്ല...... please reply...... please
@GAMEOLOGIST
@GAMEOLOGIST 3 жыл бұрын
@Joseph George 😂
@GOODIESS
@GOODIESS 3 жыл бұрын
Enthenkilum comedy parayin changhayimare
@muhaimenkm1
@muhaimenkm1 3 жыл бұрын
Implemented whole program. You can refer reverse() method for reversing the linkedlist. /** * @author Muhaimen */ public class ReverseLinkedList { Node head = null; Node tail = null; public static void main(String[] args) { ReverseLinkedList list = new ReverseLinkedList(); list.add(10); list.add(20); list.add(30); System.out.println("###DISPLAY BEFORE REVERSING###"); list.display(); System.out.println("###DISPLAY AFTER REVERSING###"); list.reverse(); list.display(); } public void add(int data) { Node newNode = new Node(data); if (head == null) head = newNode; else tail.next = newNode; tail = newNode; } public void reverse() { Node current = head; Node next = null, prev = null; while (current != null) { next = current.next; current.next = prev; prev = current; current = next; } head = prev; } public void display() { Node temp = head; if (temp == null) System.out.println("List is Empty"); while (temp != null) { System.out.println(temp.data); temp = temp.next; } } class Node { int data; Node next; public Node(int data) { this.data = data; } } }
@jelanmathewjames2579
@jelanmathewjames2579 2 жыл бұрын
# Class for Linked List O(n)TS All code with reversing a Linkedlist class LinkedList(): # Creating head and tail variable head = None tail = None # Class Node, creating data and next variable on calling this class class Node(): def __init__(self,data): self.data = data self.next = None # Function to add node def addnode(self,data): #creating object node node = self.Node(data) #Checking head is None (head never changes) if self.head == None: #if none placing node object to head self.head = node #if head not none then placing node object to next varible #that points next node next variable contain address of next node #(tail changes) else: self.tail.next = node #placing node object to tail self.tail = node #To display Linked List def display(self): if(self.head == None): print("No Value") return temp = self.head while temp != None: print(temp.data) temp = temp.next #To delete a node def delete(self,data): temp = self.head if temp != None and temp.data == data: self.head = temp.next temp.next = None return while(temp!=None and temp.data != data): previous = temp temp = temp.next if temp == None: return if temp == self.tail: self.tail = previous self.tail.next = None return previous.next = temp.next temp.next = None #To insert node def insertafter(self,addafter,data): newnode = self.Node(data) temp = self.head if(temp != None and temp.data == addafter): newnode.next = temp.next temp.next = newnode return while(temp != None and temp.data != addafter): temp = temp.next if temp == None: return if temp == self.tail: self.tail.next = newnode self.tail = newnode return newnode.next = temp.next temp.next = newnode def deleterepetitiondata(self): current = self.head while current != None: if current.next != None: if current.next != self.tail: if current.data == current.next.data: current.next = current.next.next else: current = current.next else: if current.data == current.next.data: current.next = None self.tail = current break else: break else: break def reverselinkedlist(self): current = self.head next = current.next if next == None: return next_to = next.next if current != None and current == self.head: current.next = None next.next = current if next == self.tail: self.tail, self.head = self.head, self.tail return current = next next = next_to while next != self.tail: next_to = next.next next.next = current current = next next = next_to if next == self.tail: next.next = current self.tail, self.head = self.head, self.tail return
Part9DataStructure
32:59
Brototype Malayalam
Рет қаралды 24 М.
Part6DataStructure
26:16
Brototype Malayalam
Рет қаралды 40 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
Part19DataStructure
46:01
Brototype Malayalam
Рет қаралды 10 М.
Part10DataStructure
42:25
Brototype Malayalam
Рет қаралды 15 М.
Part 8 | Decision making in Python | Python Programming Malayalam Free Tutorial | Luminar Technolab
17:33
Luminar Technolab - IT Finishing School
Рет қаралды 1,7 М.
From a ₹5,500 monthly salary job to a software engineer..!
36:55
Brototype Malayalam
Рет қаралды 138 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН