Eat Study Love

먹고 공부하고 사랑하라

파이썬 자료구조 9

Determine the Minimum Sum of a k-avoiding Array[M,Math,Greedy]

https://leetcode.com/problems/determine-the-minimum-sum-of-a-k-avoiding-array/description/You are given two integers, n and k.An array of distinct positive integers is called a k-avoiding array if there does not exist any pair of distinct elements that sum to k.Return the minimum possible sum of a k-avoiding array of length n. Example 1:Input: n = 5, k = 4Output: 18Explanation: Consider the k-av..

Coding_Practice 2024.07.22

Review 8 - Python Data Structure

https://eglife.tistory.com/75 Review 7 - Python Algorithm design & Testing & Debugginghttps://eglife.tistory.com/74 Review 6 - Python Recursion & Merge Sorthttps://eglife.tistory.com/73 Review 6 - Python Search(Linear / Binary) & Sort(Selection / Insertion)https://eglife.tistory.com/72 Review 5 - Python OOP(Objected Oriented Programming)eglife.tistory.com의사소통을 할 때, 못 알아 들었으면 못 알아 들었다고 확실히 말하자. 이..

SW 만학도/Python 2024.07.08

Review 3 - Loop & Set,Tuple,Dictionaries,Mutability

https://eglife.tistory.com/66 Review 2 - Python의 기본 Module , Classhttps://eglife.tistory.com/65 Review 1 - Python programming basics프로그래밍은 안 쓰다 보면 까먹는다. 더군다나 전공자가 아니면 정말 1~2주만 정신 놓고 있다가 복귀했을 때 굉장히 기초적인 코딩도 손에 잡eglife.tistory.comModule을 통으로 import를 하나, 그 중에 일부만 import를 하나 memory 측면에선 전혀 차이가 없다만,Global namespace에서 어떤 이름이 올라와 있냐의 차이만 있었다.---> math가 올라와 있어서 math.sqrt 등 dot을 통해 접근하냐?vs from math impo..

SW 만학도/Python 2024.07.02

13. Data Structures (Trees)

https://eglife.tistory.com/38 12. Data Structures ( Stacks & Queues ) https://eglife.tistory.com/30 11. Data Structures ( Arrays & Linked Lists ) 본격적인 자료구조에 대한 공부! Python에서 list를 겁~나게 다뤘는데, 사실 이 List는 고마운 친구였다는 것이다. 그 고마운 List의 내부구조 eglife.tistory.com 슬 복잡해지는 자료구조 지금껏 배웠던 자료구조는 Linear하다면 이제는 non-Linear한 Case도 슬슬 나온다. Tree의 정의 - Tree / Subtree의 Recursive한 구조이다. - Node = Vertex = 꼭지 - Root : Paret..

SW 만학도/Python 2024.03.25

12. Data Structures ( Stacks & Queues )

https://eglife.tistory.com/30 11. Data Structures ( Arrays & Linked Lists ) 본격적인 자료구조에 대한 공부! Python에서 list를 겁~나게 다뤘는데, 사실 이 List는 고마운 친구였다는 것이다. 그 고마운 List의 내부구조를 톺아보자 ㅠㅠ List가 [1,2,3,4,5] 만 있던 메모리 공간이 eglife.tistory.com Data의 또 다른 구조인 Stack 과 Queue에 대해 알아보는 시간! Stack - ex) 식판 쌓고 가져가기 --> Las it First out , 키보드에서 Back Space --> 마지막에 쓴 문자를 지운다. - ex) 프로그래밍에서 괄호를 쌓기 --> 괄호 열 때마다 Stack 쌓고 닫을 때마다 S..

SW 만학도/Python 2024.03.25

6. Sets, Tuples, and Dictionaries

Python의 보다 다양한 자료구조를 알아보자. 다~ 나중에 요긴하게 쓰일 자료구조라 정확히 구분짓고 넘어가는 것이 중요! Sets - 집합 - 순서가 따로 없고, 모든 원소는 서로 달라야한다. Unordered and Distinct - 원소를 추가/삭제할 순 있지만 수정할 순 없다. Immutable alphabet = {'a','b','b','a','d','c','c','e'} alphabet {'a', 'b', 'c', 'd', 'e'} - 중괄호롤 사용해 위와 같이 Set을 선언할 수 있다. - 중복되는 것 제거 + 순서 마음대로 재정렬되는 것 확인(Unordered and Distinct) #An empty set empty = set() empty1 = {} # 이것은 Dictionary!!..

SW 만학도/Python 2024.03.15