0% found this document useful (0 votes)
18 views

Topics_for_Study_Computaional Thinking

The document covers various fundamental concepts in computer science, including Boolean Logic, Information, computational problems, data structures like lists and arrays, and algorithms. It explains key topics such as recursion, data encoding, logical reasoning, and modularization, along with examples and applications. Additionally, it discusses sorting techniques and the importance of space and time efficiency in algorithms.

Uploaded by

aniruddh2573
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Topics_for_Study_Computaional Thinking

The document covers various fundamental concepts in computer science, including Boolean Logic, Information, computational problems, data structures like lists and arrays, and algorithms. It explains key topics such as recursion, data encoding, logical reasoning, and modularization, along with examples and applications. Additionally, it discusses sorting techniques and the importance of space and time efficiency in algorithms.

Uploaded by

aniruddh2573
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

a) Boolean Logic

Boolean Logic is a form of algebra which is centered around three simple words known as Boolean
Operators: “Or,” “And,” and “Not”. At the heart of Boolean Logic is the idea that all values are
either true or false.

b) Define Information.
Information is stimuli that has meaning in some context for its receiver. When information is
entered into and stored in a computer, it is generally referred to as data. After processing -- such as
formatting and printing -- output data can again be perceived as information. When information is
compiled or used to better understand something or to do something, it becomes knowledge.

c) computational Problem
A computational problem is a problem that may be solved by an algorithm. For example, the problem
of factoring "Given a positive integer n, find a nontrivial prime factor of n."
is a computational problem. A computational problem can be viewed as
a set of instances or cases together with a, possibly empty, set of solutions for every instance/case.
For example, in the factoring problem, the instances are the integers n, and solutions are prime
numbers p that are the nontrivial prime factors of n

d) repetition in flowchart
Repetition : A sequence of steps which are repeated a number of times is called repetition. For a
repeating process to end, a decision must be made. The decision is usually called a test.

A traffic lights example follows :

e) Differentiate between List and Array


S.No. List Array

1 List is used to collect items that An array is also a vital component that
usually consist of elements of collects several items of the same data type.
multiple data types.

2 List cannot manage arithmetic Array can manage arithmetic operations.


operations.

3 It consists of elements that belong to It consists of elements that belong to the


the different data types. same data type.
4 When it comes to flexibility, the list When it comes to flexibility, the array is
is perfect as it allows easy not suitable as it does not allow easy
modification of data. modification of data.

5 It consumes a larger memory. It consumes less memory than a list.

6 In a list, the complete list can be In an array, a loop is mandatory to access


accessed without any specific the components of the array.
looping.

7 It favors a shorter sequence of data. It favors a longer sequence of data.

f) Define Factoring.
Factoring (called "Factorising") is the process of finding the factors:
Factoring: Finding what to multiply together to get an expression.
It is like "splitting" an expression into a multiplication of simpler expressions.
Example: factor 2y+6
Both 2y and 6 have a common factor of 2:
• 2y is 2 × y
• 6 is 2 × 3
So we can factor the whole expression into:
2y+6 = 2(y+3)
So 2y+6 has been "factored into" 2 and y+3

g) Recursion/example of recursion
Recursion is a process by which a function calls itself directly or indirectly. The corresponding
function is called as recursive function. It is a computer programming technique involving the use
of a procedure, subroutine, function, or algorithm that calls itself one or more times until a specified
condition is met at which time the rest of each repetition is processed from the last one called to the
first.

Example : The factorial function can be written as a recursive function call. Recall that factorial(n)
= n × (n – 1) × (n – 2) × … × 2 × 1. The factorial function can be rewritten recursively
as factorial(n) = n × factorial(n – 1).

h) Data Encoding
Encoding is the process of using various patterns of voltage or current levels to represent 1s and 0s of
the digital signals on the transmission link.
The common types of line encoding are Unipolar, Polar, Bipolar, and Manchester.
Encoding Techniques
The data encoding technique is divided into the following types, depending upon the type of data
conversion.
• Analog data to Analog signals − The modulation techniques such as Amplitude Modulation,
Frequency Modulation and Phase Modulation of analog signals, fall under this category.
• Analog data to Digital signals − This process can be termed as digitization, which is done by
Pulse Code Modulation PCMPCM. Hence, it is nothing but digital modulation. As we have
already discussed, sampling and quantization are the important factors in this. Delta Modulation
gives a better output than PCM.
• Digital data to Analog signals − The modulation techniques such as Amplitude Shift
Keying ASKASK, Frequency Shift Keying FSKFSK, Phase Shift Keying PSKPSK, etc., fall
under this category.
o Digital data to Digital signals − These are in this section. There are several ways to map digital
data to digital signals.

i) Proportional Logic
propositional logic is a branch of mathematical logic which studies the logical relationships
between propositions (or statements, sentences, assertions) taken as a whole, and connected
via logical connectives.
Propositional logic is also known by the names sentential logic, propositional
calculus and sentential calculus. It is useful in a variety of fields, including computer logic
gates.

j) data

Data is a collection of facts, such as numbers, words, measurements, observations or just


descriptions of things.
Data can be qualitative or quantitative.
• Qualitative data is descriptive information (it describes something)
• Quantitative data is numerical information (numbers)

k) Logical Reasoning
Logical reasoning consists of aptitude questions that require a logical level of analysis to arrive at the
correct solution. Most of the questions are constructed based on concepts and the rest are out of the
box thinking ones.
Logical reasoning is classified into two types:
1. Verbal Reasoning: It is the ability to logically understand the concepts and solve problems
expressed in words. Verbal reasoning tests the ability of extraction of information and
implications in a sentence.
2. Non-verbal Reasoning: It is the ability to logically understand the concepts and solve
problems expressed in numbers/letters/figures in combination with words. Non-verbal
reasoning tests the ability of deduction and induction of logic of information and implications
in a problem

l) modularization in flowchart
Modular design is a technique for breaking down a complex system (such as a large application)
into smaller components called modules. Each of these modules can be developed independently,
and should contain everything required to execute one part of the overall application.

m) example of List.
A list can be define as below
1. L1 = ["John", 102, "USA"]
2. L2 = [1, 2, 3, 4, 5, 6]
a) proportional logic and application of it
Definition: A proposition is a statement that can be either true or false; it must be one or the other,
and it cannot be both. EXAMPLES. The following are propositions: – the reactor is on; – the
wing-flaps are up; – John Major is prime minister.
Applications of Propositional Logic : In the computer science field, propositional logic has a wide
variety of applications and hence is very important. It is used in system specifications, circuit
designing, logical puzzles, etc. Apart from this, it can also be used in translating English sentences
to mathematical statements and vice-versa.

b) Decomposition and example of decomposition.


Decomposition is to breaking something into parts, that together are the same as the original.
Decomposition of numbers means breaking down numbers into parts. The practice of
decomposing numbers helps in developing number sense and understanding their place value.
Decomposition also helps in understanding the different place values of different digits in a number.
Example, 19. Here, digit 1 is in the tens place, and digit 9 is in the ones place. This means 19 has 1
ten and 9 ones. You can write 19 as:
19 = 10 + 9 (1 ten + 9 ones)
So, 19 can be decomposed as 10 + 9.

c) Abstraction and example of abstraction in computer science.


Abstraction is commonly defined as the extraction of relevant information from a larger data set,
where utilizing abstraction allows engineers and others to simplify a codebase. In computer science,
abstraction typically means simplification and separating the signal from the noise in order to make
programming more efficient and effective.
Example : An API is an intermediary that allows applications to communicate but abstracts the details
of what is being communicated and how—simplifying the process of application-to-application
communication and providing a level of security.

d) proportional logic and application of it.


propositional logic is a branch of mathematical logic which studies the logical relationships
between propositions (or statements, sentences, assertions) taken as a whole, and connected via
logical connectives.
Propositional logic is also known by the names sentential logic, propositional
calculus and sentential calculus. It is useful in a variety of fields, including computer logic gates.
Application : Boolean Search : Searches of things like the web, or large databses, such as our
library's catalog, often can be done using logical operators.
Example: Mexico AND university -New
Searches Google for pages containing "Mexico" and "university" but not "New".

e) What is Boolean Logic? example of it.


Boolean Logic is a form of algebra which is centered around three simple words known as Boolean
Operators: “Or,” “And,” and “Not”. At the heart of Boolean Logic is the idea that all values are
either true or false.

Example : Describe the numbers that meet the condition:


even and less than 10 and greater than 0
The numbers that satisfy all three requirements are {2, 4, 6, 8}

f) Describe Logical Reasoning with example.


Logical reasoning consists of aptitude questions that require a logical level of analysis to
arrive at the correct solution. Most of the questions are constructed based on concepts and the
rest are out of the box thinking ones.
Logical reasoning is classified into two types:
1. Verbal Reasoning: It is the ability to logically understand the concepts and solve
problems expressed in words. Verbal reasoning tests the ability of extraction of
information and implications in a sentence.
2. Non-verbal Reasoning: It is the ability to logically understand the concepts and solve
problems expressed in numbers/letters/figures in combination with words. Non-verbal
reasoning tests the ability of deduction and induction of logic of information and
implications in a problem
Example: "When it rains, things outside get wet. The grass is outside, therefore: when it
rains, the grass gets wet." Mathematical logic and philosophical logic are commonly
associated with this type of reasoning. Inductive reasoning attempts to support a
determination of the rule.
===========================================================================
a) simple algorithms used in computer programs.
There are many different kinds of algorithms for solving problems, but the majority may be divided
into a few distinct categories. To master algorithms online, these are the most crucial ones. These
include-
• Searching Algorithms: Binary and linear search algorithms are two examples of search
algorithms.
• Sorting Algorithms: There are many different sorting algorithms, such as rapid sort, merge sort,
selection sort, insertion sort, bubble sort, shell sort, radix sort, etc.
• Divide and Conquer: Divide and conquer is the process of breaking an issue into smaller
components and then tackling each one separately. This covers operations like quicksort and merges
sort.
• Greedy Algorithm: As the name implies, we begin with a greedy method selection based on a set
of priorities. Problems with scheduling are included.
• Dynamic Programming: In this algorithm, we divide the problems into smaller, more manageable
problems, solve those first, then try to solve the combined problem using the knowledge from the
smaller problems. The solutions to the subproblems must also be saved for further use.
• Graph traversal Algorithms: Algorithms for traversing a graph, including Depth First Search
(DFS) and Breadth-First Search (BFS).

b) space-efficiency with example.


That is the amount of (memory) space the algorithm will take up before it terminates with the correct
solution. In order to identify the space-wise efficiency we need to look at the amount of data
structures used as the algorithm is running. When considering space-wise efficiency, the aim is to
utilise data structures which take up the least amount in memory.

Examples:
• populating a list with variables of type real will be space-wise inefficient, when it is clear that only
whole numbers (integers) will ever be needed to solve the problem.
• initialising an array with a length of 1000 will be space-wise inefficient, when it is clear that the
maximum elements to be stores will be 100.

c) Explain time-efficiency with example.


This is the amount of time it takes for the algorithm to terminate with the correct solution.
Any measure of time will depend on other factors, like
• the particular version and type of programming language used to implement the algorithm;
• the hardware specification on which the implementation will be running;
• and of course the input to the algorithm, e.g. searching through a very very large set will take
longer that searching through a short set and searching for an item which does not exist in a set will
take longer than searching for an item which is present in a given set.
a) Explain any two sorting techniques.
1. Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the
adjacent elements if they are in the wrong order. This algorithm is not suitable for large data
sets as its average and worst-case time complexity is quite high.
How does Bubble Sort Work?
Input: arr[] = {5, 1, 4, 2, 8}
First Pass:
• Bubble sort starts with very first two elements, comparing them to check which one is
greater.
• ( 5 1 4 2 8 ) –> ( 1 5 4 2 8 ), Here, algorithm compares the first two
elements, and swaps since 5 > 1.
• ( 1 5 4 2 8 ) –> ( 1 4 5 2 8 ), Swap since 5 > 4
• ( 1 4 5 2 8 ) –> ( 1 4 2 5 8 ), Swap since 5 > 2
• ( 1 4 2 5 8 ) –> ( 1 4 2 5 8 ), Now, since these elements are already in order
(8 > 5), algorithm does not swap them.
Second Pass:
• Now, during second iteration it should look like this:
• ( 1 4 2 5 8 ) –> ( 1 4 2 5 8 )
• ( 1 4 2 5 8 ) –> ( 1 2 4 5 8 ), Swap since 4 > 2
• ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 )
• ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 )
Third Pass:
• Now, the array is already sorted, but our algorithm does not know if it is completed.
• The algorithm needs one whole pass without any swap to know it is sorted.
• ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 )
• ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 )
• ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 )
• ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 )

2. Bucket Sort Bucket sort is mainly useful when input is uniformly distributed over a range. For
example, consider the following problem.

Sort a large set of floating point numbers which are in range from 0.0 to 1.0 and are uniformly
distributed across the range. How do we sort the numbers efficiently?

A simple way is to apply a comparison based sorting algorithm. The lower bound for Comparison
based sorting algorithm (Merge Sort, Heap Sort, Quick-Sort .. etc) is Ω(n Log n), i.e., they cannot
do better than nLogn.

Can we sort the array in linear time? Counting sort can not be applied here as we use keys as index
in counting sort. Here keys are floating point numbers.
The idea is to use bucket sort. Following is bucket algorithm.

bucketSort(arr[], n)
1) Create n empty buckets (Or lists).
2) Do following for every array element arr[i].
.......a) Insert arr[i] into bucket[n*array[i]]
3) Sort individual buckets using insertion sort.
4) Concatenate all sorted buckets.
b) Write a code for factorial using recursion.
def factorial(x):
"""This is a recursive function
to find the factorial of an integer"""
if x == 1:
return 1
else:
return (x * factorial(x-1))
num = 3
print("The factorial of", num, "is", factorial(num))

c) Binary searching technique.


Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search
interval in half. The idea of binary search is to use the information that the array is sorted and
reduce the time complexity to O(Log n).
Binary Search Algorithm: The basic steps to perform Binary Search are:
• Begin with the mid element of the whole array as a search key.
• If the value of the search key is equal to the item then return an index of the search key.
• Or if the value of the search key is less than the item in the middle of the interval,
narrow the interval to the lower half.
• Otherwise, narrow it to the upper half.
• Repeatedly check from the second point until the value is found or the interval is empty.

d) linear searching technique.


Linear search is also called as sequential search algorithm. It is the simplest searching algorithm. In
Linear search, we simply traverse the list completely and match each element of the list with the item
whose location is to be found. If the match is found, then the location of the item is returned; otherwise,
the algorithm returns NULL.
It is widely used to search an element from the unordered list, i.e., the list in which items are not sorted.
The worst-case time complexity of linear search is O(n).

The steps used in the implementation of Linear Search are listed as follows -
o First, we have to traverse the array elements using a for loop.
o In each iteration of for loop, compare the search element with the current array element, and -
o If the element matches, then return the index of the corresponding array element.
o If the element does not match, then move to the next element.
o If there is no match or the search element is not present in the given array, return -1.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy