Skip to content

Commit

Permalink
Add euclidean distance program in python
Browse files Browse the repository at this point in the history
  • Loading branch information
parammittal16 committed Dec 25, 2018
1 parent 2756887 commit 0fdafc4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
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

0 comments on commit 0fdafc4

Please sign in to comment.