suzker
BAN USER
UB
the whole idea is to use DP to count each step that could cause the guy dead. The DP program will keep generating branches of possible paths and after the guy dead that branch will be closed and no more counting will be occurred. Also, the total steps will be counted.
correct me if im wrong, the following is the python code...
def dp_walking_dead(x, y, N,m, n):
deadCount = 0
totalCount = 0
while (N>0):
if x>0:
featureWalkResult = dp_walking_dead(x-1, y, N-1, m, n)
deadCount += featureWalkResult[0]
totalCount += featureWalkResult[1]
else:
deadCount += 1
if x<m-1:
featureWalkResult = dp_walking_dead(x+1, y, N-1, m, n)
deadCount += featureWalkResult[0]
totalCount += featureWalkResult[1]
else:
deadCount += 1
if y>0:
featureWalkResult = dp_walking_dead(x, y-1, N-1, m, n)
deadCount += featureWalkResult[0]
totalCount += featureWalkResult[1]
else:
deadCount += 1
if y<n-1:
featureWalkResult = dp_walking_dead(x, y+1, N-1, m, n)
deadCount += featureWalkResult[0]
totalCount += featureWalkResult[1]
else:
deadCount += 1
totalCount += 4
N -= 1
return [deadCount, totalCount]
Repirenedpisano, Blockchain Developer at ABC TECH SUPPORT
Hello, I am Irene and I live in Pittsburgh, USA. I am working as A production worker and my duty ...
Repleroydperry, Backend Developer at AppNexus
I am from the USA. I am 27 year old. I drive the train for my company Monk Home Funding ...
Repjennifertkramer, AT&T Customer service email at ADP
I had a dream to open my own Restaurant in FL. and i came true all dream with my hard ...
Reprobinroi335, Android test engineer at ABC TECH SUPPORT
I believe the deepest changes you can make to improve your quality of life. how to break a family curse ...
Repjuanajcox4, Python Developer at Axiom Sources
I have 2 years of experience in designing and implementing computer algorithms or models for creating, displaying, and processing various ...
Repfredlhenry, Android Engineer at Digital Merkating
Hi, I am Fred, 27 years old, I have done bachelor’s in IT.I have been working for a ...
Repbarrietrosado, abc at ABC TECH SUPPORT
Hi, I am Barrie, from Ualapue USA. I believe that every challenge has a solution - and I take great satisfaction ...
Reppaulinedsisk, Testing / Quality Assurance at Cloudmere, Inc.
I want to become a successful professional in a highly competitive technological world where performance is rewarded with exciting new ...
Repjessicajbunting, Aghori Mahakal Tantrik at ABC TECH SUPPORT
Hi I am Jessica, from Houston USA. I am working as a manager in Incredible Universe company. I enjoy additional ...
Repadak4257, Applications Developer at Adobe
I am fond of Listening Songs then reading newspapers which are all about a story of a beautiful nature and ...
Repjosephcday6, Android Engineer at Absolute Softech Ltd
I am SEO Executive in Elek-Tek company. I live in Morgantown USA. I won’t write any details about Best ...
Repbrakpeter2, AT&T Customer service email at Absolute Softech Ltd
My Profession Is photography for a number of years.My Friends were interested in photography, so I was always exposed ...
Reppaulaamontalvo, AT&T Customer service email at AMD
I am working as Human Resources Associates, and my duties are for obtaining, recording, and interpreting human resources information within ...
Reprachelwrosa1, Computer Scientist at ABC TECH SUPPORT
Hello, I am Rachel and I live in Charleston, USA. I am working as a data entry clerk who is ...
RepRileyAllen, Analyst at British Telecom
I enjoy spending my spare time outside and engaging in activities such as hiking, swimming, biking, and jogging. Explore new ...
Repsarahchannah745, Android Engineer at ASAPInfosystemsPvtLtd
Hello, I am an information records clerk.We are responsible for maintaining their company records in a complete and orderly ...
Replestermauldin, Assignment editor at Royal Gas
I am Lester Assignment editor . I am responsible for organizing the assignment desk to operate around the clock. I often ...
Repcharlespladd, Android Engineer at Abs india pvt. ltd.
I am Charles from Pascoag USA. I have strong knowledge of pain management systems. And I have experience in providing ...
Repmakaylaangwin, Backend Developer at Abs india pvt. ltd.
I'm part owner of Bloom Floral Land, an Australian floral design company. Life is really short, try to smile ...
Repmarywwaldrop7, Computer Scientist at Chelsio Communications
I am Mary ,working in the field of training and development coordinator for three years, focusing on teaching English as ...
RepAvikaEthan, Data Engineer at Adjetter Media Network Pvt Ltd.
Avika Ethan has five years of experience collecting physical and biological data in California streams and rivers. In the field ...
unless you have a parallel machine... PRAM or MESH, one just can't do it in O(n) time because it will take m*n to traverse all data...
- suzker August 30, 2012now if we assume m=n, and yes the traversal time will be O(2n)=O(n), but we are talking about sorting and that's something we can't make it faster than O(n log n) time unless in special cases.
i mean... what's the point for this question, really, in person!?