Package adt

Examples of adt.LinkedList


import adt.LinkedList;

public class Q038_Merge_a_linked_list_into_another_linked_list_at_alternate_positions {

  public static void main(String[] args) {
    LinkedList l1 = new LinkedList(new int[]{5, 7, 17, 13, 11});
    LinkedList l2 = new LinkedList(new int[]{12, 10, 2, 4, 6, 7, 8});
    merge(l1.head, l2.head);
  }
View Full Code Here


import adt.LinkedList;

public class Q039_Pairwise_swap_elements_of_a_given_linked_list_by_changing_links {

  public static void main(String[] args) {
    LinkedList list = new LinkedList(7);
    pairWiseSwap(list.head);
  }
View Full Code Here

import adt.LinkedList;

public class Q024_Segregate_Even_And_Odd_Nodes {

  public static void main(String[] args) {
    LinkedList list = new LinkedList(new int[]{17, 15, 8, 12, 10, 5, 4, 1, 7, 6});
    ListNode head = segregate(list.head);
    head.print();
  }
View Full Code Here

import adt.LinkedList;

public class Q020_Merge_Two_Sorted_Linked_Lists {

  public static void main(String[] args) {
    LinkedList a = new LinkedList(new int[]{5, 10, 15});
    LinkedList b = new LinkedList(new int[]{2, 3, 20});
    ListNode c = merge(a.head, b.head);
   
    if (c != null) {
      c.print();
    }
View Full Code Here

import adt.LinkedList;

public class Q025_Add_Two_Numbers_Represented_By_Linked_Lists {
 
  public static void main(String[] args) {
    LinkedList a = new LinkedList(new int[]{5, 6, 3, 4});
    LinkedList b = new LinkedList(new int[]{8, 4, 2, 9});
    ListNode c = add(a.head, b.head);
    c.print();
  }
View Full Code Here

import adt.LinkedList;

public class Q037_Delete_N_nodes_after_M_nodes_of_a_linked_list {

  public static void main(String[] args) {
    LinkedList list = new LinkedList(10);
    skipMdeleteN(list.head, 3, 2);
    list.print();
  }
View Full Code Here

public class Q012A_Remove_Duplicates_From_Sorted_Linked_List_A {

  public static void main(String[] args) {
    int[] arr = {11, 11, 11, 21, 43, 43, 60};
    LinkedList list = new LinkedList(arr);
   
    removeDups(list);
  }
View Full Code Here

import adt.LinkedList;

public class Q028_Find_a_triplet_from_three_linked_lists_with_sum_equal_to_a_given_number {

  public static void main(String[] args) {
    LinkedList a = new LinkedList(new int[]{12, 6, 29});
    LinkedList b = new LinkedList(new int[]{23, 5, 8});
    LinkedList c = new LinkedList(new int[]{90, 20, 59});
   
    b.mergeSort(true);
    c.mergeSort(false);
   
    findSumTriple(a.head, b.head, c.head, 101);
  }
View Full Code Here

public class Q010_Insert_In_Sorted_List {
 
  public static void main(String[] args) {
    int[] arr = {1, 2, 3, 5, 7, 9};
    LinkedList list = new LinkedList(arr);
    insert(list, new ListNode(6));
  }
View Full Code Here

import adt.LinkedList;

public class Q006C_Reverse_Linked_List_In_Groups_of_Given_Size {

  public static void main(String[] args) {
    LinkedList list = new LinkedList(8);
    list.head = reverse(list.head, 3);
    list.print();
  }
View Full Code Here

TOP

Related Classes of adt.LinkedList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.