Python Algorithm Implementations Collection
Greedy Coin Change Algorithm
from sys import maxsize as infinite
def solve(coins, change):
change_list = []
while change > 0 and coins != [0] * len(coins):
max_coin = max(coins)
index = coins.index(max_coin)
if change >= coins[index]:
change_list.append(index + 1)
change -= coins[index]
coins[index] = 0
return change_listGreedy Knapsack Algorithm
def solve(items, capacity):
taken = []
value = 0
items = sorted( Read More
Audience, Stage & Group Dynamics for Speakers
Public and Stage Considerations
Key elements to consider regarding the audience and stage setup for any speaking event.
Audience Analysis
The audience is the group of individuals who will receive a speech, lecture, or presentation on a specific topic.
Elements to consider about the audience:
- Age
- Socio-cultural level
- Education
- Profession
- Audience Type (Homogeneous/Heterogeneous)
Audience Types
Heterogeneous Audience: Composed of individuals with diverse socioeconomic characteristics, tastes, interests, and
Read MoreNational Income Accounting: GDP, GNP & Economic Indicators
National Income Accounting Fundamentals
1. Measuring National Income and Output
A fundamental principle is that everything produced generates income for someone. The primary measure is Gross Domestic Product (GDP).
GDP: The total market value of all final goods and services produced within a country’s borders during a specific period.
Methods for Measuring GDP
In a Closed Economy:
- Sum the Value Added: Calculate the value added by all firms located in the economy.
- Value Added = Value of Output – Value of
US History Milestones: Colonization to Civil Rights Era
Discovery and Colonization of America
Christopher Columbus reached the Americas in 1492. Following this, colonists came to the New World for various reasons, creating colonies with distinct social, religious, political, and economic structures in different locations.
The Thirteen Colonies
- New Hampshire
- Massachusetts
- Rhode Island
- New York
- Connecticut
- New Jersey
- Pennsylvania
- Delaware
- Virginia
- Maryland
- North Carolina
- South Carolina
- Georgia
17th Century: The New World and American Values
In the 17th century, America
Read MoreRoman Senate: Powers, Composition, and Functions
Roman Senate: Powers, Composition & Procedures
The Senatus Consultum: Senate Decisions
The Senate’s decision, which served as advice or a report on a specific question, was known as a senatus consultum. These were formally written down, detailing the circumstances, merits, and a summary of relevant interventions. Subsequently, quaestors kept them for study and interpretation.
Key Powers of the Republican Senate
The powers of the Senate can be summarized as follows:
Auctoritas Patrum: Ratifying Laws
This
La Celestina: Characters, Themes, and Plot Analysis
La Celestina by Fernando de Rojas
A play written by Fernando de Rojas, a lawyer of likely Jewish origin. It is believed he wrote the entire play, possibly expanding upon an existing first act.
Plot Summary
The story revolves around the tragic love affair of the young nobles Calisto and Melibea. It begins when Calisto accidentally encounters Melibea and falls instantly in love. Following her rejection, he employs the services of a renowned procuress named Celestina.
Once Celestina successfully arranges
Read MoreAlmohad Architecture: Koutoubia, Hassan Mosque & Giralda
Koutoubia Mosque, Marrakech
(Also known as the Mosque of the Booksellers)
Architectural Features
- Style: Almohad
- Arches: Pointed horseshoe arches are prevalent. The most elaborate, adjoining the qibla nave, are lambrequin (polylobed) arches. The arch of the axial nave is a slightly pointed horseshoe arch with a scalloped effect (similar to lambrequin arches).
- Decoration: Includes scalloping and tracery. Plaster decoration on the arch intrados features networks of diamonds (sebka).
- Mihrab: Inspired by the
Famous Spanish Romances: El Cid, Abenamar, Prisoner, Arnaldos
Romance of El Cid: Diego Lainez
This romance belongs to the Cid cycle. Rodrigo Díaz de Vivar, El Cid, is the most famous figure of the medieval epic. R. Díaz de Vivar, a historical character of the 11th century, was an intelligent member of the pequeña nobleza (lesser nobility) who would later face the high nobility in the struggle for power and social advancement.
The epic poem of the Cid, which led to the romances, focused on transmitting the values of the good vassal, featuring a gentleman respectful
Read MoreLower Limb Muscle Anatomy, Joints, and Neuroglia Details
Lower Limb Muscle Anatomy
| Name | Origin | Insertion | Action | Innervation |
|---|---|---|---|---|
| Fibularis Longus (Peroneus Longus) | Proximal lateral fibula, lateral condyle of tibia | Base of first metatarsal, medial cuneiform | Eversion and plantarflexion of foot | Superficial fibular nerve |
| Fibularis Brevis (Peroneus Brevis) | Distal lateral fibula | Base of fifth metatarsal | Eversion and plantarflexion of foot | Superficial fibular nerve |
| Tibialis Anterior | Lateral condyle and proximal tibia, interosseous membrane | Medial cuneiform, base of first metatarsal | Dorsiflexion |
Essential Accounting Formulas for Financial Statements
Balance Sheet Equations
Assets = Liabilities + Equity
Current Ratio = Current Assets / Current Liabilities
Net Accounts Receivable = Gross Accounts Receivable – Allowance for Uncollectibles
Allowance for Uncollectibles = Gross Receivables x Estimated Percentage
Net Realizable Value (NRV) = Accounts Receivable – Ending Allowance for Doubtful Accounts
Equity and Stock Transactions
Issuing stock increases Equity.
Common Stock Balance = Number of Shares Issued x Par Value per Share
Additional Paid-in Capital
Read More