Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add euclidean distance program in python #873

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Mathematics/euclidean distance/euclidean_distance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import math
# Example points in 3-dimensional space...
x = (5, 6, 7)
y = (8, 9, 9)
distance = math.sqrt(sum([(a - b) ** 2 for a, b in zip(x, y)]))
print("Euclidean distance from x to y: ",distance)
18 changes: 8 additions & 10 deletions linkedlist.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
Step 1. Create a new node and assign the address to any node say ptr.
Step 2. OVERFLOW,IF(PTR = NULL)
write : OVERFLOW and EXIT.
Step 3. ASSIGN INFO[PTR] = ITEM
Step 4. IF(START = NULL)
ASSIGN NEXT[PTR] = NULL
ELSE
ASSIGN NEXT[PTR] = START
Step 5. ASSIGN START = PTR
Step 6. EXIT
Inserting at end of linked list

create newnode with vale newnode -> next as null
check if list is empty(head==null)
if empty, set head=newnode
if notempty then define a node pointer temp and initialize with head
keep moving temp until temp-> next is equal to null
set temp -> next=newnode