Skip to content

Commit

Permalink
first commit 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sokiyev-t committed Oct 7, 2023
1 parent 3b850aa commit 585aaaa
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added __pycache__/oop.cpython-310.pyc
Binary file not shown.
38 changes: 38 additions & 0 deletions binary_search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from oop import Student

st=[
Student("Sanjar", 15, 73, "male"),
Student("Umar", 16, 73, "male"),
Student("Rashid", 18, 73, "male"),
Student("Gulnora", 19, 73, "male"),
Student("Mansur", 22, 73, "male"),
Student("Maksim", 22, 73, "male"),
Student("Samad", 24, 73, "male"),
Student("Nigora", 26, 73, "female"),
Student("Raxim", 29, 73, "male"),
]


def binary_search(st, val):
l=0
h=len(st)-1
while h>=l:
m=(h+l)//2
if st[m].get_age()==val:
return m
elif st[m].get_age()>val:
h=m-1
else:
l=m+1
return None

ind=binary_search(st,22)
if ind:
st[ind].print()
else:
print("Student not found!")


# for s in st:
# if s.get_age()==24:
# s.print()
36 changes: 18 additions & 18 deletions oop.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ def print(self):
e3=Employee("Madina", 22, 74, "female")
e4=Employee("Mansur", 17, 71, "male")

a=[s1,s2,e1,e2,e3,e4]

for p in a:
if p.get_age()>18 and p.sex=="male":
print("--------------------------")
p.print()




T sum<T>(T a, T b) {
return a+b;
}


int k=sum<int>(3,4);

Vector<int> v;
# a=[s1,s2,e1,e2,e3,e4]
#
# for p in a:
# if p.get_age()>18 and p.sex=="male":
# print("--------------------------")
# p.print()
#
#
#
#
# T sum<T>(T a, T b) {
# return a+b;
# }
#
#
# int k=sum<int>(3,4);
#
# Vector<int> v;



Expand Down

0 comments on commit 585aaaa

Please sign in to comment.