Java Script
Java Script
reverse datastruture
linklist
stack and queue diff
binary search dnc algo
one more dnc ask
oops concepts pillar of oops with example basic program
introduction:-
why tcs?
I envision myself as a valued member of the TCS team, having made significant
contributions to the company's success while continuing to grow both personally and
professionally.In the first few years, I aim to immerse myself in various projects
and opportunities to deepen my understanding of TCS's services, technologies, and
industry trendsAs I gain experience and expertise, I aspire to take on leadership
roles where I can lead teams, mentor junior colleagues, and drive project success.
I want to contribute to fostering a collaborative and high-performing team
environment within TCS.
as my role is for the hardware and the software is taken from the mit youtube.
as i have connected jumper wire Arduino relay module blutooth module capicitors led
etc.
Linked Lists: A linked list is a linear collection of elements, where each element
(node) contains a data value and a reference (or link) to the next node in the
sequence. Linked lists allow efficient insertion and deletion of elements but do
not support random access.
Stacks: A stack is a last-in, first-out (LIFO) data structure that allows elements
to be added or removed only from one end, called the top. It is commonly used for
managing function calls, expression evaluation, and undo operations.
Queues: A queue is a first-in, first-out (FIFO) data structure that allows elements
to be added at the rear (enqueue) and removed from the front (dequeue). It is used
for managing tasks in a sequential manner, such as in scheduling algorithms and
breadth-first search.
Graphs: A graph is a collection of nodes (vertices) and edges that connect pairs of
nodes. It is used to represent relationships between objects, such as in social
networks, network routing, and dependency analysis.
In a singly linked list, each node contains a data value and a single link pointing
to the next node in the sequence. The last node typically points to NULL to
indicate the end of the list.
Doubly Linked List:
In a doubly linked list, each node contains both a data value and two links: one
pointing to the next node and another pointing to the previous node. This allows
for traversal in both forward and backward directions.
Circular Linked List:
In a circular linked list, the last node points back to the first node, forming a
circular structure. This can simplify certain operations, such as traversal, since
there is no distinct end to the list.
difference between
what is dnc?
DNC" typically stands for "Divide and Conquer," which is a fundamental algorithmic
paradigm used in computer science for solving problems.
In the Divide and Conquer approach, a problem is divided into smaller subproblems
that are similar to the original problem but smaller in size. These subproblems are
then solved recursively, and their solutions are combined to solve the original
problem.
Divide: The problem is divided into smaller subproblems that are similar to the
original problem but smaller in size. This step often involves partitioning the
input data or breaking it down into smaller pieces.
Conquer: The subproblems are recursively solved. If the subproblems are small
enough, their solutions are computed directly. Otherwise, the Divide and Conquer
approach is applied recursively to solve them.
Combine: The solutions to the subproblems are combined to solve the original
problem. This step may involve merging the solutions, computing a final result from
the solutions of the subproblems, or performing other operations to derive the
solution to the original problem.
Binary search is a widely used searching algorithm that efficiently finds the
position of a target value within a sorted array or list. It works by repeatedly
dividing the search interval in half until the target value is found or the
interval is empty.
Initialization:
Binary search starts with the entire array as the search interval.
It sets two pointers, low and high, to the first and last indices of the array,
respectively.
Search:
While the low pointer is less than or equal to the high pointer:
Calculate the middle index of the current search interval as (low + high) // 2.
Compare the target value with the middle element of the array.
If the target value matches the middle element, the search is successful, and the
index of the target is returned.
If the target value is less than the middle element, update the high pointer to be
one less than the middle index, restricting the search to the lower half of the
array.
If the target value is greater than the middle element, update the low pointer to
be one more than the middle index, restricting the search to the upper half of the
array.
If the target value is not found after the entire array is searched, return a
special value (such as -1) to indicate that the target is not present in the array.
Termination:
The search terminates when the low pointer exceeds the high pointer, indicating
that the search interval is empty and the target value is not present in the array.
These four principles form the foundation of Object-Oriented Programming and are
often summarized by the acronym "PIEA" (Polymorphism, Inheritance, Encapsulation,
and Abstraction).
Modularity: Breaking down complex systems into smaller, manageable units (objects).
Object-Oriented Programming languages, such as Java, C++, Python, and C#, provide
built-in support for creating and working with objects, classes, and the principles
of OOP.
Bubble Sort: Bubble sort repeatedly steps through the list, compares adjacent
elements, and swaps them if they are in the wrong order. The process repeats until
the list is sorted.
Selection Sort: Selection sort divides the list into a sorted and an unsorted
portion. It repeatedly selects the smallest (or largest) element from the unsorted
portion and swaps it with the first element of the unsorted portion.
Insertion Sort: Insertion sort builds the final sorted array one element at a time.
It iterates through the array, removing one element from the input data, finds its
correct position in the sorted portion of the array, and inserts it there.
Merge Sort: Merge sort is a divide-and-conquer algorithm that divides the array
into two halves, recursively sorts each half, and then merges the sorted halves. It
combines sorted arrays into a single sorted array.
Quick Sort: Quick sort is another divide-and-conquer algorithm that selects a pivot
element, partitions the array into two subarrays (elements less than the pivot and
elements greater than the pivot), recursively sorts each subarray, and then
combines the sorted subarrays.
Heap Sort: Heap sort builds a max-heap (or min-heap) from the input array and
repeatedly extracts the maximum (or minimum) element from the heap and rebuilds the
heap until the array is sorted.