Anonymous
Not logged in
Talk
Contributions
Create account
Log in
WikiKnowledgeBase
Search
Editing
Technology/Software Development/General knowledge/Programming Fundamentals/Algorithms
(section)
From WikiKnowledgeBase
Namespaces
Page
Discussion
More
More
Page actions
Read
Edit
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Common Algorithmic Concepts == As you dive deeper into the world of algorithms, you will come across some common concepts. Here are a few fundamental ones: '''Sorting Algorithms:''' Sorting algorithms arrange a collection of elements in a specific order, such as numerical or alphabetical. An example of a sorting algorithm is the Bubble Sort: <pre> function bubbleSort(arr): n = length(arr) for i from 0 to n-1: for j from 0 to n-i-1: if arr[j] > arr[j+1]: swap(arr[j], arr[j+1]) return arr </pre> '''Search Algorithms:''' Search algorithms find a specific element within a collection. An example of a search algorithm is the Binary Search, commonly used for sorted arrays: <pre> function binarySearch(arr, target): low = 0 high = length(arr) - 1 while low <= high: mid = (low + high) // 2 if arr[mid] == target: return mid elif arr[mid] < target: low = mid + 1 else: high = mid - 1 return -1 </pre> '''Recursion:''' Recursion is a technique where a function calls itself to solve a smaller instance of the same problem. Here's an example of a recursive function to calculate the factorial of a number: function factorial(n): if n == 0: return 1 else: return n * factorial(n-1) '''Conclusion''' Algorithms are powerful tools that enable computers to solve problems and perform tasks efficiently. By understanding the fundamental concepts of algorithms, you can develop computational thinking and enhance your problem-solving skills.
Summary:
Please note that all contributions to WikiKnowledgeBase may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
My wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Random page
Categories
Help about MediaWiki
Wiki tools
Wiki tools
Special pages
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs