Giter Site home page Giter Site logo

python-for-algorithms--data-structures--and-interviews's People

Contributors

b4shy avatar damtur avatar jmportilla avatar pierian-data avatar remimarenco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-for-algorithms--data-structures--and-interviews's Issues

Array Pair Sum

This is about Array Pair Sum.ipynb in Array Sequence Interview Questions - PRACTICE. This notebook is part of lectures 53 and 54.

Though the notebook is located in the PRACTICE folder, I want to point out that the function returns an incorrect result for pair_sum([1,3,2,2],3).

  • The result of pair_sum([1,3,2,2],3) is 2.
  • The result of pair_sum([1,3,2,2],3) should be 1 since (1,2) appears twice ((1,2), (2,1)) but unique sums are searched for.

Maybe this should be added to the list of test cases.
Just to make sure all is clear and nobody gets the wrong idea while solving this problem.

typo

In folder:
Algorithm Analysis and Big O

In notebook:
Big O Examples .ipynb

Notebook link

In Section:
Calculating Scale of Big-O

Type here:
"If you've taken a calculus class before, this will reminf you of taking limits towards infinity."

Can't clone repository on Windows

This repository makes use of very long filepaths/filenames. Subfolders state the full name of the module and then repeat the name in the interview questions section, i.e.:

Python-for-Algorithms--Data-Structures--and-Interviews
    /Stacks, Queues and Deques
        /Stacks, Queues, and Deques Interview Problems
            Implement a Queue -Using Two Stacks - SOLUTION.ipynb

When trying to clone the whole repository to my Windows machine, it is not possible to complete because the filenames of some folders are too long when stored in the typical folder I use for Github repos (which has a not-too-deep path of ~30 characters itself).

Consider renaming folders to make it possible to clone the entire repository instead of manually downloading .pynb files one by one.

Balance Paren test cases missing test for extra closing parens

It is possible to write a function that passes all current tests in the Balanced Parentheses Check problem but that fails with an IndexError if a closing parentheses occurs when there is an empty stack.

Adding this test case handles the issue:

assert_equal(sol('][[[]])]'),False)

AssertionError


AssertionError Traceback (most recent call last)
in ()
13 # Run Tests
14 t = AnagramTest()
---> 15 t.test(anagram)

in test(self, sol)
4
5 def test(self,sol):
----> 6 assert_equal(sol('go go go','gggooo'),True)
7 assert_equal(sol('abc','cba'),True)
8 assert_equal(sol('hi man','hi man'),True)

/anaconda3/lib/python3.6/unittest/case.py in assertEqual(self, first, second, msg)
827 """
828 assertion_func = self._getAssertEqualityFunc(first, second)
--> 829 assertion_func(first, second, msg=msg)
830
831 def assertNotEqual(self, first, second, msg=None):

/anaconda3/lib/python3.6/unittest/case.py in _baseAssertEqual(self, first, second, msg)
820 standardMsg = '%s != %s' % _common_shorten_repr(first, second)
821 msg = self._formatMessage(msg, standardMsg)
--> 822 raise self.failureException(msg)
823
824 def assertEqual(self, first, second, msg=None):

AssertionError: False != True

Fibonacci corrections

In https://github.com/jmportilla/Python-for-Algorithms--Data-Structures--and-Interviews/blob/master/Recursion/Recursion%20Interview%20Problems/Recursion%20Problems/Recursion%20Problem%203%20-%20Fibonacci%20Sequence.ipynb

The results for the Nth number in the sequence are not clear, unless the start of the sequence begins with the Nth number of 0, i.e.

N=0, 0
N=1, 1
N=2, 1
N=3, 2
N=4, 3
N=5, 5
N=6, 8
N=7, 13
N=8, 21
N=9, 34
N=10, 55
etc.

The description seems to confuse the Fibonacci sequence with a factorial sequence, when it says:

Remember that a fibonacci sequence: 0,1,1,2,3,5,8,13,21,... starts off with a
base case checking to see if n = 0 or 1, then it returns 1.

Else it returns fib(n-1)+fib(n+2).

This should read:

Remember that a Fibonacci sequence: 0,1,1,2,3,5,8,13,21,... starts off with a
base case checking to see if n = 0 or 1, then it returns n, 
else it returns fib(n-1) + fib(n-2).
  • if n = 0 or 1, then it returns n (not 1)
  • there is a typo in fib(n-1)+fib(n+2), it should be fib(n-1)+fib(n-2).

Hope this is right and helps to make a correction.

PS, thanks for a great course

Return error instead of raise error?

I'm not exactly sure this is an issue but I'm going through your Udemy course right now (great course by the way!) and I was wondering about this part.

Dynamic Array Exercise.ipynb

def __getitem__(self, k):
    """
    Return element at index k
    """
    if not 0 <= k < self.n:
        return IndexError('K is out of bounds!') # Check it k index is in bounds of array

    return self.A[k] #Retrieve from array at index k

Is there a particular reason why you use return IndexError instead of raise IndexError? I've searched a bit on the internet but cannot find a similar example. I'm only familiar with using raise IndexError and this is the first time I've seen an error returned like that.

Thanks!

EDIT:

Just noticed a potential typo in your code as I was re-reading my comment.

# Check it k index
        ^^
#       if ?

Typo Issue in Big O Examples .ipynb

In folder:
Algorithm Analysis and Big O

In notebook:
Big O Examples .ipynb

Notebook link

In Section:
Calculating Scale of Big-O

Type here:
"If you've taken a calculus class before, this will reminf you of taking limits towards infinity.

###(Correct the spelling of remind)

Invalid zipped folder

When I try to download the zipped folder from Github and Extract files -> It gives invalid file Error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.