31
Aug

### Free Deep Learning eBooks

Deep Learning is a subfield of Machine Learning which learns from example. It is highly used in driverless cars, sentiment analysis, credit scoring, fraud detection etc. Below is the list of free Deep Learning ebooks with their download link curated from different sources. Hope, you will find them useful in preparing for Deep Learning.

• TensorFlow for Deep Learning – From Linear Regression to Reinforcement Learning [Download]

If you would like to list your ebook free of cost or would like to contribute, do comment or reach out to us. Did you check about other free eBooks about:

28
Aug

### Shell Sort

Question:

Write a program to perform shell sort on [85,63,0,12,47,96,52]

Program:

Explanation:

Step 1 − Initialize the value of h

Step 2 − Divide the list into smaller sub-list of equal interval h

Step 3 − Sort these sub-lists using insertion sort

Step 4 − Repeat until complete list is sorted

Output:

28
Aug

### Merge Sort

Question:

Write a program to perform merge sort on [85,63,0,12,47,96,52]

Program:

Explanation:

Step 1 − if it is only one element in the list it is already sorted, return.

Step 2 − divide the list recursively into two halves until it can no more be divided.

Step 3 − merge the smaller lists into new list in sorted order.

Output:

27
Aug

### Lexiographic Sort

Question:

Write a program to sort ‘GlobalSQA’ lexiographically

Program:

Explanation:

The lexicographic or lexicographical order (also known as lexical order, dictionary order, alphabetical order or lexicographical product) is a generalization of the way the alphabetical order of words is based on the alphabetical order of their component letters. The sorted function sorts it for you.

Output:

26
Aug

### Bubble Sort

Question:

Write a program to perform bubble sort on [85,63,0,12,47,96,52]

Program:

Explanation:

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order.

Output:

25
Aug

### Insertion Sort

Question:

Write a program to perform insertion sort on [85, 63, 0, 12, 47, 96, 52]

Program:

Explanation:

Step 1 − If it is the first element, it is already sorted. return 1

Step 2 − Pick next element

Step 3 − Compare with all elements in the sorted sub-list

Step 4 − Shift all the elements in the sorted sub-list that is greater than the value to be sorted

Step 5 − Insert the value

Step 6 − Repeat until list is sorted

Output:

24
Aug

### Quick Sort

Question:

Write a program to perform Quick sort on [85, 63, 0, 12, 47, 96, 52]

Program:

Explanation:

Quicksort is a divide and conquer algorithm. Quicksort first divides a large array into two smaller sub-arrays: the low elements and the high elements. Quicksort can then recursively sort the sub-arrays.

The steps are:

1. Pick an element, called a pivot, from the array.
2. Partitioning: reorder the array so that all elements with values less than the pivot come before the pivot, while all elements with values greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in its final position. This is called the partition operation.
3. Recursively apply the above steps to the sub-array of elements with smaller values and separately to the sub-array of elements with greater values.

The base case of the recursion is arrays of size zero or one, which never need to be sorted.

Output:

21
Aug

### Sum of diagonal elements using Comprehension

Question:

Write a program to find the sum of diagonal elements in a matrix.

Program:

Explanation:

Comprehensions provide a concise way to create new set of elements that satisfy a given condition from an iterable. Here the iterable is the for loop looking for diagonal elements. The list thus formed is passed to sum which returns the sum of elements in the list.

Output:

19
Aug

### Reverse a number

Question:

Write a program to reverse a number

Program:

Explanation:

The while loop contains the statements to isolate or separate the digits of a number ,which is then multiplied to 10 and sums the reminder. Thus you get the reverse.

Let’s try it out

Say n=366

while val>0//True, then reminder is 6,reverse also 6 and val is 36

while 36>0//True, then reminder is 6, reverse is (6*10)+6 =66, and val is 3

while 3>0// True, then reminder is 3,reverse is (66*10)+3=663 and val is 0

Hence reverse is 663

Output:

18
Aug

### Sum of diagonal elements

Question:

Write a program to find the sum of diagonal elements

Program:

Explanation:

Diagonal elements are those where i=j, as in a[0][0], a[1][1] etc.the for loop cheks every instant if i is equal to j, if true value of a[i][j] is incremented to sum.

Output:

17
Aug

### Length of a string

Question:

Write a program to find the length of a string without inbuilt function

Program:

Explanation:

The strlen function return 0 if the string is empty. Otherwise it adds one to the index position of it;s last element obtained by s.rindex.

Output:

16
Aug

### Transpose Two matrices in Python

Question:

Write a program to transpose two matrices

Program:

Explanation:

The transpose of a matrix is an operator which flips a matrix over its diagonal, that is it switches the row and column indices of the matrix by producing another matrix denoted as AT (also written A′, AtrtA or At). It is achieved by any one of the following equivalent actions:

The transpose AT of a matrix Acan be obtained by reflecting the elements along its main diagonal. Repeating the process on the transposed matrix returns the elements to their original position.

• reflect A over its main diagonal (which runs from top-left to bottom-right) to obtain AT
• write the rows of A as the columns of AT
• write the columns of A as the rows of AT

Formally, the i th row, j th column element of AT is the j th row, i th column element of A:

If A is an m × n matrix then AT is an n × m matrix.

Output:

10
Aug

### Fetch all links from a page using Python

Question:

Program:

Explanation:

The urllib2 module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world — basic and digest authentication, redirections, cookies and more.

re module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched can be Unicode strings as well as 8-bit strings.

Output:

bodrum escort - eskişehir esc - mersin escort - mersin escort bayan - mersin esc