Data Structures and Algorithms · Programming Languages · Software Engineering

Coding: Reversing Unordered Single Linked List using 2 Pointers

Puzzle Given an Unsorted Single Linked List, provide an Algorithm to reverse such Linked List using only 2 pointers. Input A Single Linked List. Example. 1 -> 4 -> 3 -> 2 -> 0 Output A Reversed Single Linked List. Example. 0 -> 2 -> 3 -> 4 -> 1   Solution Using Java as… Continue reading Coding: Reversing Unordered Single Linked List using 2 Pointers

Data Structures and Algorithms · Software Engineering

Coding: Flattening Nested Arrays

Puzzle Given an array of Integers that presents several levels of nesting, provideĀ an algorithm to flatten the input array. Input A nested array of arrays. Example. [[1,2,[3]],4] Output A flat array. Example. [1,2,3,4]   Solution using Java as Programming Language Gist with runnable code and tests. Discussion To get the job done, the solution adopts… Continue reading Coding: Flattening Nested Arrays