Monthly Archives: June 2017

Not all programmers are nerd

https://www.quora.com/What-should-you-never-say-to-a-programmer/answer/Ohingsho-Jajabor

Heap Sort

Steps:
If we want to sort in ascending then we create a min heap
If we want to create in descending then we create in max heap

Once the heap is created we delete the root node from heap and put the last node in the root position and repeat the steps till we have covered all the elements.
For ascending order:
1. Build Heap
2. Transform the heap into min heap
3. Delete the root node

pseudocode:

source:
http://www.algorithmist.com/index.php/Heap_sort

Implemented code:

output:

Took help from these two links:
http://www.codingeek.com/algorithms/heap-sort-algorithm-explanation-and-implementation/
http://www.geeksforgeeks.org/heap-sort/

Complexity Analysis:
Time Complexity for MaxHeapify: O(logn)
Complexity for BuildHeap: O(n)
Complexity of heapSort:
Worst, Avergae, Base case: O(n*logn)
It is inplace algorithm.
Space Complexity: O(1)

Big Oh, Theta and Omega Notation confusion clearing

https://stackoverflow.com/questions/471199/what-is-the-difference-between-%CE%98n-and-on

Merge Sort

Algorithm Video:

https://youtu.be/TzeBrDU-JaY

Merge Sort Combines Two Sorted file in a large bigger sorted files:
This Merge sort happens in a two steps:

This sorting is a example of divide and conquer approach:
1. Selection: Splits a list into two lists (This process is recursive approach)
2. Merging: It joins two list in a one list (It follows the pesudocode in itertive manner)

Pseudocode:

 

Implementation:
code with extra malloc declaration:

code by me without  extra malloc:

output:

Analysis of Running Time Complexity:
https://youtu.be/0nlPxaC2lTw
Worst case, Best case, Avergae case: Theta(nlogn)
Space Complexity: Theta(n)

 

This link can help to solve problems:
https://gist.github.com/mycodeschool/9678029
https://www.hackerearth.com/practice/algorithms/sorting/merge-sort/tutorial/

http://www.sanfoundry.com/cpp-program-implement-merge-sort/

Merge Sort

Algorithm Video:

https://youtu.be/TzeBrDU-JaY

Merge Sort Combines Two Sorted file in a large bigger sorted files:
This Merge sort happens in a two steps:

This sorting is a example of divide and conquer approach:
1. Selection: Splits a list into two lists (This process is recursive approach)
2. Merging: It joins two list in a one list (It follows the pesudocode in itertive manner)

Pseudocode:

 

Implementation:
code with extra malloc declaration:

code by me without  extra malloc:

output:

Analysis of Running Time Complexity:
https://youtu.be/0nlPxaC2lTw
Worst case, Best case, Avergae case: Theta(nlogn)
Space Complexity: Theta(n)

 

This link can help to solve problems:
https://gist.github.com/mycodeschool/9678029
https://www.hackerearth.com/practice/algorithms/sorting/merge-sort/tutorial/

http://www.sanfoundry.com/cpp-program-implement-merge-sort/

Merge Sort

Algorithm Video:

https://youtu.be/TzeBrDU-JaY

Merge Sort Combines Two Sorted file in a large bigger sorted files:
This Merge sort happens in a two steps:

This sorting is a example of divide and conquer approach:
1. Selection: Splits a list into two lists (This process is recursive approach)
2. Merging: It joins two list in a one list (It follows the pesudocode in itertive manner)

Pseudocode:

 

Implementation:
code with extra malloc declaration:

code by me without  extra malloc:

output:

Analysis of Running Time Complexity:
https://youtu.be/0nlPxaC2lTw
Worst case, Best case, Avergae case: Theta(nlogn)
Space Complexity: Theta(n)

 

This link can help to solve problems:
https://gist.github.com/mycodeschool/9678029
https://www.hackerearth.com/practice/algorithms/sorting/merge-sort/tutorial/

http://www.sanfoundry.com/cpp-program-implement-merge-sort/

Bubble Sort

This video is good to help:
https://www.youtube.com/watch?v=TL2_3sqvogo

I have also taken help from DS Made Easy by Karumanchi book to find the algo pesudocode.

Pseudocode:

Implementation:

I need to improve this algorithm as it is not passing all the sizes of array so there will be some vacant position in array which increases the complexity in the running time so we need to out of the loop when it has nothing to swap, so our improvised algorithm will be:

Pseudocode:

 

Implementation:

This below video can help for better optimization that implemented in the above code:

https://www.youtube.com/watch?v=Jdtq5uKz-w4&list=PL2_aWCzGMAwKedT2KfDMB9YA5DgASZb3U&index=3

Time Complexity in Running Time:

Worst Case: O(n^2)
BEst Case without improve: O(n^2)
Best Case(Improvised): O(n)
Average Case: O(n^2)
Space Complexity: O(1)
Simulation Tried to be drawn by me:

 

Software Development Life Cycle

Selection Sort

https://youtu.be/GUDLRan2DWM?list=PL2_aWCzGMAwKedT2KfDMB9YA5DgASZb3U

PSeudoCode:

Implemented Code:

output:

 

Selection Sort

https://youtu.be/GUDLRan2DWM?list=PL2_aWCzGMAwKedT2KfDMB9YA5DgASZb3U

PSeudoCode:

Implemented Code:

output:

 

Selection Sort

https://youtu.be/GUDLRan2DWM?list=PL2_aWCzGMAwKedT2KfDMB9YA5DgASZb3U

PSeudoCode:

Implemented Code:

output:

 

QuickSort

Youtube Video:
https://www.youtube.com/watch?v=COk73cpQbFQ

Analaysis though it seems little bit tough to me:

https://www.youtube.com/watch?v=3Bbm3Prd5Fo

HackerRank video:

MIT video:
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/lecture-4-quicksort-randomized-algorithms/

Pseudo Code from upper Youtube vid:

 

Implementation:

Slightly edited in *A to A[]:

Some change with before and after show:

Complete Quicksort Implementation and taking user input:

Output from the above code:

Geeks for geeks:
http://quiz.geeksforgeeks.org/quick-sort/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=700151

From geeks for geeks but may be there might be some problems there

Another good one for understanding(I think it’s the best one):
https://www.youtube.com/watch?v=3DV8GO9g7B4

Pseudocode available in the above video:

implemented code:

 

 


Quick Sorting in Process

Time and Space complexity: Best Case : omega(nlogn)
Worst case: O(n^2)

See this video to clear up the skills:
https://www.youtube.com/watch?v=DpNmUP4wuf8

ideone example: http://ideone.com/oWbONR
Others Code:
http://www.cc.gatech.edu/classes/cs3158_98_fall/quicksort.html
Recursive:
http://www.algolist.net/Algorithms/Sorting/Quicksort
CLRS:
http://www.bowdoin.edu/~ltoma/teaching/cs231/fall09/Lectures/5-quicksort/quicksort.pdf

Google Search Terms:
https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1PRFC_enBD706BD706&ion=1&espv=2&ie=UTF-8#q=quick+sort+pseudocode&*

SOLID Concepts

Object Oriented Programming Concepts

Interview Experience: Software Engineering Interview Guideline for Freshers in Bangladesh

Today given an interview for intern position so, I think they asked me some questions that is related to other interview which was Full Time Software Engineering Job I have faced. I have found an pattern for interview purpose in software engineering position in Bangladesh:

Maximum of them ask:
OOP Concept Basic like, What is class, What is Overriding and Overloading(Must be good at it, why it is needed), Polymorphism, Interface, Inherit etc.
Object Oriented Design – Design Pattern, SOLID priniciple
Algorithm Basics – All Sorting but Bubble Sort, Merge Sort, QuickSort, Binary Search Tree(BST) Is must to see first
Software Development Life Cycle(SDLC) Phases, UML Actors, and Scrum/Agile methodology
Basic SQL, Join, Normalization

-> Basic OS/RAM Related Questions-> Stack/Heap where actually program runs that knowledge
What is call by value and What is call by reference

content included in this blog link below must be finished and  must be in head when needed anything: http://blog.devskill.com/%E0%A6%B8%E0%A6%AB%E0%A6%9F%E0%A6%93%E0%A7%9F%E0%A7%8D%E0%A6%AF%E0%A6%BE%E0%A6%B0-%E0%A6%A1%E0%A7%87%E0%A6%AD%E0%A7%87%E0%A6%B2%E0%A6%AA%E0%A6%BE%E0%A6%B0%E0%A6%A6%E0%A7%87%E0%A6%B0-%E0%A6%9C%E0%A6%A8/