Problem Description
Write a solution to display the first 3 rows of the given DataFrame employees
.
Key Insights
- The problem requires accessing a subset of a DataFrame.
- We need to handle the DataFrame structure and extract the first three entries.
- This is a straightforward task that involves indexing.
Space and Time Complexity
Time Complexity: O(1) - Accessing the first three rows is a constant time operation. Space Complexity: O(1) - We are not using additional data structures that scale with input size.
Solution
The solution involves using a DataFrame structure, typically found in data manipulation libraries like pandas in Python. The algorithm accesses the first three rows using indexing techniques provided by the DataFrame API. This is done by leveraging built-in functions that allow for row selection.