FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Bitwise Algorithm and Linear Search updated by suvanbalu · Pull Request #132 · AllAlgorithms/python · GitHub

This repository was archived by the owner on Sep 7, 2025. It is now read-only.
/ python Public archive
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 11 additions & 0 deletions algorithms/bit manipulation/twice_unique.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def twice_unique(arr:list) :
unique = 0
for i in arr:
unique ^= i
return unique
if __name__=="__main__":
array = list(map(int,input().split()))
#sample input
# 1 2 2 3 4 4 3
element = twice_unique(array)
print(f"Unique element in the array {array} is {element}")
11 changes: 11 additions & 0 deletions algorithms/bit manipulation/xor_swap.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def swap(a:int,b:int) -> list :
a=a^b
b=b^a
a=a^b
return [a,b]

if __name__=="__main__":
a=int(input("Enter Number 1 : "))
b = int(input("Enter Number 2 : "))
AfterSwap= swap(a,b)
print(f"After Swap : {AfterSwap[0],AfterSwap[1]}")
2 changes: 1 addition & 1 deletion algorithms/searches/linear_search.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def linear_search(arr, item):

# Tests

print(search([1,2,3,4,5], 3))
print(linear_search([1,2,3,4,5], 3))

Back | FazBrowse Home | New Git URL