Challenge

Project 1

 Arrays

EQUILIBRIUM POINT

EquilibriumPoint

OUTPUT:

  • Equilibrium point is: 3

EquilibriumPoint

OUTPUT:

  • Equilibrium point is: 1

------------------------------------------------------------------------------------------------------------------------

LEADERS IN AN ARRAY

LeadersInAnArray

OUTPUT:

  • 17 5 2

LeadersInAnArray

OUTPUT:

  • 4 0

--------------------------------------------------------------------------------------------------------------------------

String

REVERSE WORDS IN A GIVEN STRING

ReverseWords

OUTPUT:

  • Reverse Words in a given String: i.like.this.program.very.much
  • Reverse Words in a given String: pqr.mno

-------------------------------------------------------------------------------------------------------------------------

REMOVE DUPLICATES

RemoveDuplicates

OUTPUT:

  • Remove String Duplicates: skilync

RemoveDuplicates_1

OUTPUT:

  • Remove String Duplicates: Skil ync oure

--------------------------------------------------------------------------------------------------------------------------

LinkedList

FINDING MIDDLE ELEMENT IN A LINKED LIST

FindMiddleElement

OUTPUT:

  • 5->Null

    The middle Element is [5]

    4->5->Null

    The middle Element is [5]

    3->4->5->Null

    The middle Element is [4]

    2->3->4->5->Null

    The middle Element is [4]

    1->2->3->4->5->Null

    The middle Element is [3]

FindMiddleElement_1

OUTPUT:

  • 12->Null

    The middle Element is [12]
    11->12->Null

    The middle Element is [12]
    10->11->12->Null

    The middle Element is [11]
    9->10->11->12->Null

    The middle Element is [11]
    8->9->10->11->12->Null

    The middle Element is [10]
    7->8->9->10->11->12->Null

    The middle Element is [10]
    6->7->8->9->10->11->12->Null

    The middle Element is [9]
    5->6->7->8->9->10->11->12->Null

    The middle Element is [9]
    4->5->6->7->8->9->10->11->12->Null

    The middle Element is [8]
    3->4->5->6->7->8->9->10->11->12->Null

    The middle Element is [8]
    2->3->4->5->6->7->8->9->10->11->12->Null

    The middle Element is [7]
    1->2->3->4->5->6->7->8->9->10->11->12->Null

    The middle Element is [7]

---------------------------------------------------------------------------------------------------------------------------

REVERSE A LINKED LIST

ReverseLinkedList

OUTPUT:

  • Given linked list
  • 6 5 4 3 2 1
  • Reversed LInked list
  • 1 2 3 4 5 6

ReverseLinkedList_1

OUTPUT:

  • Given linked list
  • 20 40 60 70 50 10
  • Reversed LInked list
  • 10 50 70 60 40 20

--------------------------------------------------------------------------------------------------------------------------

PAIRWISE SWAP ELEMENTS OF A LINKED LIST

PairWiseSwapElement

OUTPUT:

  • Linked list Before calling pairWiseSwap()
  • 8 7 6 5 4 2 2 1
  • Linked list After calling pairWiseSwap()
  • 7 8 5 6 2 4 1 2

---------------------------------------------------------------------------------------------------------------------------

ADD TWO NUMBERS REPRESENTED BY LINKED LISTS

AddTwoNumbersLinkedLists

OUTPUT:

  • 3 9 0

AddTwoNumbersLinkedLists_1

OUTPUT:

  • 7 0

----------------------------------------------------------------------------------------------------------------------------

 Trees

BINARY TREE TO DLL

BinaryTree

OUTPUT:

  • 25 12 30 10 36 15

---------------------------------------------------------------------------------------------------------------------------

Graph

BELLMAN FORD ALGORITHM

BellmanFortAlgorithm

OUTPUT:

  • The distance of vertex 1 from vertex 0 is -1. Its path is [0, 1]
  • The distance of vertex 2 from vertex 0 is 2. Its path is [0, 1, 2]
  • The distance of vertex 3 from vertex 0 is -2. Its path is [0, 1, 4, 3]
  • The distance of vertex 4 from vertex 0 is 1. Its path is [0, 1, 4]
  • The distance of vertex 2 from vertex 1 is 3. Its path is [1, 2]
  • The distance of vertex 3 from vertex 1 is -1. Its path is [1, 4, 3]
  • The distance of vertex 4 from vertex 1 is 2. Its path is [1, 4]
  • The distance of vertex 1 from vertex 3 is 1. Its path is [3, 1]
  • The distance of vertex 2 from vertex 3 is 4. Its path is [3, 1, 2]
  • The distance of vertex 4 from vertex 3 is 3. Its path is [3, 1, 4]
  • The distance of vertex 1 from vertex 4 is -2. Its path is [4, 3, 1]
  • The distance of vertex 2 from vertex 4 is 1. Its path is [4, 3, 1, 2]
  • The distance of vertex 3 from vertex 4 is -3. Its path is [4, 3]

-------------------------------------------------------------------------------------------------------------------------

MINIMUM SWAPS TO SORT

MinimumSwapToSort

OUTPUT:

  • Minimum Swap To Sort is: 2

MinimumSwapToSort_1

OUTPUT:

  • Minimum Swap To Sort is: 1

-----------------------------------------------------------------------------------------------------------------------------

Stacks Queues

GET MINIMUM ELEMENT FROM STACK

MinimumElementFromStack

OUTPUT:

  • 321

====================================================================

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.